package br.com.perkins.myproject.domain;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity
@Table
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Submenu implements Serializable {

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;

	private String nome;
	private Boolean status;

	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="menu_id",referencedColumnName="id")
	private Menu menu;

	@OneToMany(mappedBy="submenu",fetch=FetchType.LAZY,cascade=CascadeType.ALL)
	private Set<AcessoSubmenu> acessosSubmenus;

	//constructor
	public Submenu() {
		super();
	}

	//getters and setters
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getNome() {
		return nome;
	}
	public void setNome(String nome) {
		this.nome = nome;
	}

	public Menu getMenu() {
		return menu;
	}
	public void setMenu(Menu menu) {
		this.menu = menu;
	}
	public Set<AcessoSubmenu> getAcessos() {
		return acessosSubmenus;
	}
	public void setAcessos(Set<AcessoSubmenu> acessosSubmenus) {
		this.acessosSubmenus = acessosSubmenus;
	}

}